package com.chengjue.transaction.service.impl;

import com.chengjue.transaction.dao.SysUserMapper;
import com.chengjue.transaction.pojo.SysUser;
import com.chengjue.transaction.pojo.SysUserExample;
import com.chengjue.transaction.service.SysUserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 描述:
 *
 * @author Kipeng Huang
 * @create 2018-02-26 下午8:20
 */
@Service
public class SysUserServiceImpl implements SysUserService {
	@Autowired
	private SysUserMapper sysUserMapper;

	@Override
	public long countByExample(SysUserExample example) {
		return sysUserMapper.countByExample(example);
	}

	@Override
	public int deleteByExample(SysUserExample example) {
		return sysUserMapper.deleteByExample(example);
	}

	@Override
	public int deleteByPrimaryKey(Long userId) {
		return sysUserMapper.deleteByPrimaryKey(userId);
	}

	@Override
	public int insert(SysUser record) {
		return sysUserMapper.insert(record);
	}

	@Override
	public int insertSelective(SysUser record) {
		return sysUserMapper.insertSelective(record);
	}

	@Override
	public List<SysUser> selectByExample(SysUserExample example) {
		PageHelper.startPage(1,20);
		PageInfo pageInfo = new PageInfo(sysUserMapper.selectByExample(example));
		System.out.println(pageInfo.toString());
		return sysUserMapper.selectByExample(example);
	}

	@Override
	public SysUser selectByPrimaryKey(Long userId) {
		return sysUserMapper.selectByPrimaryKey(userId);
	}

	@Override
	public int updateByExampleSelective(SysUser record, SysUserExample example) {
		return sysUserMapper.updateByExampleSelective(record, example);
	}

	@Override
	public int updateByExample(SysUser record, SysUserExample example) {
		return sysUserMapper.updateByExample(record, example);
	}

	@Override
	public int updateByPrimaryKeySelective(SysUser record) {
		return sysUserMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(SysUser record) {
		return sysUserMapper.updateByPrimaryKey(record);
	}
}
